package com.leetcode.LC;

import java.util.ArrayList;
import java.util.List;

public class LC1441 {
    public List<String> buildArray(int[] target, int n) {

        //与正常序数相比，缺哪个就"Push""Pop"不缺就"Push"
        ArrayList<String> list = new ArrayList<>();
        int a = 1, b = 0;
        while (a <= target[target.length - 1]) {
            if (a != target[b]) {
                list.add("Push");
                list.add("Pop");
                a++;
            } else {
                list.add("Push");
                a++;
                b++;
            }
        }
        return list;
    }
}
